
class Solution:
    def findRelativeRanks(self,nums):
        score = {}
        #通过字典方式，添加数据：下标
        for i in range(len(nums)):
            score[nums[i]] = i
        sortedScore = sorted(nums,reverse=True)
        print(sortedScore)
        answer = [0] * len(nums) #创建nums长度的数组
        for i in range(len(sortedScore)):
            res = str(i +1 )
            if i ==0:
                res = 'Gold Medal'
            if i ==1:
                res = 'Silver Medal'
            if i ==2:
                res = 'Bronze Medal'
            answer[score[sortedScore[i]]] = res
        print(score)
        return answer
if __name__ == '__main__':
    nums = [5,3,4,2,1,10]
    solution = Solution()
    print(solution.findRelativeRanks(nums))